package com.example.controller;

import com.example.model.User;
import com.example.rabbit.enums.TopicEnum;
import com.example.rabbit.send.RabbitUtil;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author anqi
 * @date 2021/8/11 14:16
 */
@RestController
@RequestMapping("/mq")
public class RabbitMQController {

    /**
     * 内存泄漏
     */
    @GetMapping("/memoryLeak")
    public void memoryLeak() {
        User user = new User();
        user.setBd(new Date());
        user.setId(1);
        user.setName("张三");
        user.setSex(true);
        RabbitUtil.send2Exchange(TopicEnum.CHECK_SQL,"ni121212kkk11_1212");
//        RabbitUtil.send2Exchange(TopicEnum.CHECK_SQL, MessageBuilder.withPayload(user).build(), user.getName().replace('/', '-').toLowerCase());
    }
}
